var express = require('express');
var router = express.Router();
var fs = require('fs');
var sendMail = require('../untils/mail.js')
var axios = require('axios');
//配置log
const log4js = require('log4js');
log4js.configure({
  appenders: { cheese: { type: 'file', filename: './logs/feedback.log' } },
  categories: { default: { appenders: ['cheese'], level: 'info' } }
});
const logger = log4js.getLogger('cheese');

//留言api
router.get('/',function(req,res){
 res.send('respond with a resource');
	console.log('get')
	console.log('请求体是:',req);
})
router.post('/writefeedback', function (req, res) {
	console.log('post请求',req.body)
	logger.info(req.body);
	sendMail("1033948449@qq.com","XNote 有人提出了新需求",req.body.params)
	return res.json({ msg: '反馈成功' });
})


module.exports = router;